<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<script>
$(function(){
	$("#voucherTemplateStateSelectId").val("${viewRequest.params['_and_state_eq_number']}");
});
</script>
<form id="pagerForm" method="get" model="viewRequest" action="#rel#">
	<input type="hidden" name="viewRequest.page" value="${page.number}" />
	<input type="hidden" name="viewRequest.size" value="${page.size}" />
	<c:forEach items="${viewRequest.params}" var="params">
		<input type="hidden" id="${params.key}" name="viewRequest.params['${params.key}']" value="${params.value}" />
	</c:forEach>
	<c:forEach items="${viewRequest.sort}" var="sort">
		<input type="hidden" name="viewRequest.sort.${sort.key}" value="${sort.value}" />
	</c:forEach>
</form>

<div class="pageHeader">
	<form rel="pagerForm" onsubmit="return navTabSearch(this);" action="${rootUrl}/member/voucher-template" method="get">
	<div class="searchBar">
		<ul class="searchContent" style="height: 50px">
			<li>
				<label>代金券编码：</label>
				<input type="text" name="viewRequest.params['_and_code_like']" value="${viewRequest.params['__and_code_like']}"/>
			</li>
			
			<li>
				<label>代金券名字：</label>
				<input type="text" name="viewRequest.params['_and_name_like']" value="${viewRequest.params['_and_name_like']}"/>
			</li>
			<li style="width: 400px">
				<label>代金券时间：</label>
				<input name="viewRequest.params['_and_startDate_ge_date']" type="text" class="date" size="20" value="${viewRequest.params['_and_startDate_ge_date'] }" placeholder="开始时间"/>
				<input name="viewRequest.params['_and_startDate_le_date']" type="text" class="date" size="20" value="${viewRequest.params['_and_startDate_le_date'] }" placeholder="结束时间"/>
			</li>
			<li>
				<label>状态：</label>
				<select id="voucherTemplateStateSelectId" name="viewRequest.params['_and_state_eq_number']">
						<option value="">全部</option>				
						<option value="0">无效</option>				
						<option value="1">有效</option>				
				</select>
			</li>
		</ul>
		<div class="subBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">检索</button></div></div></li>
			</ul>
		</div>
	</div>
	</form>
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<li><a class="add" href="${rootUrl}/member/voucher-template/new" target="dialog" width="1000" height="600" rel="voucher-templateAdd" title="添加"><span>添加</span></a></li>
		</ul>
	</div>
	<table class="table" targetType="dialog"  width="100%" layoutH="160">
		<thead>
			<tr>
				<th width="30" align="center" >序号</th>
				<th width="80">编码</th>
				<th width="80">名字</th>
				<th width="100">说明</th>
				<th width="200">商品品牌</th>
				<th width="200">商品类型</th>
				<th width="200">商品类别</th>
				<th width="80">开始时间</th>
				<th width="70">使用期限(天)</th>
				<th width="70">订单限额(元)</th>
				<th width="50">面额(元)</th>
				<th width="50">可发放总数</th>
				<th width="50">已发放数量</th>
				<th width="50">积分兑换</th>
				<th width="40">状态</th>
				<th width="100">操作</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.content}" var="voucherT" varStatus="status">
				<td>${status.count}</td>
				<td>${voucherT.code}</td>
				<td>${voucherT.name }</td>
				<td>${voucherT.description}</td>
				<td>${voucherT.goodsBrandName}</td>
				<td>${voucherT.goodsClassName}</td>
				<td>${voucherT.goodsTypeName}</td>
				<td><fmt:formatDate value='${voucherT.startDate }' pattern='yyyy-MM-dd'/></td>
				<td>${voucherT.timeLimit }</td>
				<td><fmt:formatNumber value="${voucherT.limitMoney/100}" pattern="0.00"/></td>
				<td><fmt:formatNumber value="${voucherT.price/100}" pattern="0.00"/></td>
				<td>${voucherT.giveout }</td>
				<td>${voucherT.total }</td>
				<td>${voucherT.points }</td>
				<td>
				<c:if test="${voucherT.state == 0}">无效</c:if>
				<c:if test="${voucherT.state == 1}">有效</c:if>
				
				</td>
				<td>
				   <a title="查看/编辑" target="dialog" width="1000" height="600" rel="voucher_template_edit" title="修改"  href="${rootUrl}/member/voucher-template/${voucherT.id}/edit" class="btnEdit">编辑</a>
					<a title="确定要删除这个记录吗?" target="dialogAjaxTodo" callback="navTabAjaxDone" href="${rootUrl}/member/voucher-template/${voucherT.id}?_method=delete" class="btnDel">删除</a>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="panelBar">
		<div class="pages">
			<span>显示</span>
			<select class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})">
				<option value="${page.size}">${page.size}</option>
				<option value="20">20</option>
				<option value="50">50</option>
				<option value="100">100</option>
				<option value="200">200</option>
			</select>
			<span>条，共${page.totalElements}条 </span>
		</div>
		<div class="pagination" targetType="dialog" totalCount="${page.totalElements}" numPerPage="${page.size}" pageNumShown="10" currentPage="${page.number}"></div>
	</div>
</div>
